package ui.swing.applet.javascript;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JOptionPane;

import netscape.javascript.JSObject;

public class InvokeByJSObject extends JApplet {
	
	private JButton v_btnInvokeByJSObject;
	
	@Override
	public void start() {
		add(getV_btnInvokeByJSObject(), BorderLayout.SOUTH);
	}
		
	private JButton getV_btnInvokeByJSObject() {
		if(v_btnInvokeByJSObject == null) {
			v_btnInvokeByJSObject = new JButton(new AbstractAction("JSObject") {
				public void actionPerformed(ActionEvent e) {
					JSObject win = JSObject.getWindow(InvokeByJSObject.this);
					Object result = win.call("setTableClass", new Object[]{"alternative"});
					JOptionPane.showMessageDialog(InvokeByJSObject.this, result);
				}
			});
		}
		return v_btnInvokeByJSObject;
	}
}
